﻿using Microsoft.CSharp.Activities;
using System;
using System.Activities;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WFExtended.Twitter.Activities.Designers;

namespace WFExtended.Twitter.Activities
{
    /// <summary>
    ///Returns a single direct message, specified by an id parameter.
    /// </summary>
    [ToolboxBitmapAttribute(typeof(EntryPoint), "Resources.DirectMessageToolbox.bmp")]
    [Designer(typeof(ShowDirectMessageDesigner))]
    [Description("Returns a single direct message, specified by an id parameter.")]
    public class ShowDirectMessage : TwitterOperationInvoker<DirectMessage>
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ShowDirectMessage"/> class.
        /// </summary>
        public ShowDirectMessage()
            : base("ShowDirectMessage")
        {
            ID = new InArgument<long>();
        }

        /// <summary>
        ///  The ID of the direct message.
        ///  <remarks>
        ///  Required Argument
        /// </remarks>
        /// </summary>
        /// <value>
        ///  The ID of the direct message.
        /// </value>
        [Browsable(true)]
        [Category("Parameters")]
        [Description(" The ID of the direct message.")]
        [RequiredArgument]
        public InArgument<long> ID { get; set; }

        /// <summary>
        /// Caches the metadata.
        /// </summary>
        /// <param name="metadata">The metadata.</param>
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            RuntimeArgument idArgument = new RuntimeArgument("ID", typeof(long), ArgumentDirection.In, true);
            metadata.Bind(ID, idArgument);
            metadata.AddArgument(idArgument);

            base.CacheMetadata(metadata);
        }

        /// <summary>
        /// Executes the specified context.
        /// </summary>
        /// <param name="context">The context.</param>
        protected override void Execute(NativeActivityContext context)
        {
            Parameters.Clear();

            Parameters.Add("id", ID);

            base.Execute(context);
        }


    }
}
